#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from flask import Flask

# Use flask_cors to make all routes support CORS
# The documentation of flask_cors is:
# https://flask-cors.readthedocs.io/en/latest/
from flask_cors import CORS as cors

# "alanz" use port 5001.
# flask run -p 5001

app = Flask(__name__)
cors(app)

# open index.html
with open('alanz\\index.html', mode = 'r', encoding='utf-8') as index:
    index_html = index.read()

@app.route('/')
def load_index():
    return index_html

# open alan.js
with open('alanz\\public\\alan.js', mode = 'r', encoding = 'utf-8') as js:
    alan_js = js.read()

@app.route('/alan.js')
def load_js():
    return alan_js

if __name__ == "__main__":
    app.run(port = 5001)